/*
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

package com.facebook.imagepipeline.platform;

import com.facebook.imagepipeline.memory.PoolFactory;
import com.facebook.imagepipeline.util.Pools;

public class PlatformDecoderFactory {
    /**
     * Provide the implementation of the PlatformDecoder for the current platform using the provided
     * PoolFactory
     *
     * @param poolFactory The PoolFactory
     * @return The PlatformDecoder implementation
     */
    public static PlatformDecoder buildPlatformDecoder(
            PoolFactory poolFactory, boolean gingerbreadDecoderEnabled) {
        int maxNumThreads = poolFactory.getFlexByteArrayPoolMaxNumThreads();
        return new ArtDecoder(
                poolFactory.getBitmapPool(), maxNumThreads, new Pools.SynchronizedPool<>(maxNumThreads));
    }
}
